home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu634.dms
/
pu634.adf
/
GENIES
/
SelectByAttribute.pdrx
< prev
next >
Wrap
Text File
|
1994-09-06
|
15KB
|
403 lines
/*
Copyright 1992 StarTeck. All rights reserved.
This Genie will select the objects with the specified attributes.
Just answer prompts...
*/
call pdm_AutoUpdate(0)
cr = '0a'x
commands.1 = "Position"
commands.2 = "Size"
commands.3 = "Line Color"
commands.4 = "Line Pattern"
commands.5 = "Fill Pattern"
commands.6 = "Line Weight"
commands.7 = "Line Join"
commands.8 = "Lock" /* ProDraw function IsLocked not working */
prompt = commands.1
do i = 2 to 7
prompt = prompt || cr || commands.i
end
LastUsed = 'NotUsed'
PreviouslyUsed = getclip(PreUsed)
if PreviouslyUsed = ON then do
LastUsed = pdm_inform(3,'Input selection method...','RE-INPUT','Cancel','LAST USED')
if LastUsed = 1 then exit_msg()
end
response = ''
if LastUsed = 0 | LastUsed = 'NotUsed' then do
response = pdm_SelectFromList("Select objects by..",15,7,1,prompt)
if response = '' then exit_msg()
response2 = response
call setclip(lastusedresponse,response)
do while response2 ~= ''
parse var response2 command '0a'x response2
select
when command = commands.1 then do
testinput = 1
do while testinput = 1
posprompt = 'X pos =:' ||cr|| 'Y pos =:'
checkpos = pdm_getform('Input object location...',7,posprompt)
if checkpos = '' then exit_msg(position not entered)
parse var checkpos checkposX (cr) checkposY
if datatype(checkposX,'N') & datatype(checkposY,'N') then do
checkposX = trunc(checkposX,4)
checkposY = trunc(checkposY,4)
testinput = 0
call setClip(ClipCheckposX,checkposX)
call setClip(ClipCheckposY,checkposY)
end
end /* do */
end /* when */
when command = commands.2 then do
testinput = 1
do while testinput = 1
sizeprompt = 'X width =:' ||cr|| 'Y heigth =:'
checksize = pdm_getform('Input object size...',6,sizeprompt)
if checksize = '' then exit_msg(size not entered)
parse var checksize checksizeX (cr) checksizeY
if datatype(checksizeX,'N') & datatype(checksizeY,'N') then do
checksizeX = trunc(checksizeX,4)
checksizeY = trunc(checksizeY,4)
testinput = 0
call setClip(ClipChecksizeX,checksizeX)
call setClip(ClipChecksizeY,checksizeY)
end
end /* do while */
end /* when */
when command = commands.3 then do
call GetColorPalete()
CheckLineColor = SelectFromList('Input line color to search for...',30,count,2,colorlist)
if checklinecolor = '' then exit_msg(line color not entered)
call setClip(ClipCheckLineColor,checkLineColor)
end
when command = commands.4 then do
CheckLinePtn = inform(3,'Input line pattern to search for...','ProDraw 0-8','Cancel','Custom')
if CheckLinePtn = 1 or ChecklinePtn = '' then exit_msg()
testinput = 1
if CheckLinePtn = 0 then do
linenumberlist = 0 ||cr|| 1 ||cr|| 2 ||cr|| 3 ||cr|| 4 ||cr|| 5 ||cr|| 6 ||cr|| 7 ||cr|| 8
CheckLinePtn = pdm_selectfromList('Choose Line Pattern number...',29,9,0,LineNumberList)
if CheckLinePtn = '' then exit_msg()
end /* if do */
else do while testinput = 1
lineprompt = 'ON:0.0000' ||cr|| 'OFF:0.0000' ||cr|| 'ON:0.0000' ||cr|| 'OFF:0.0000' ||cr|| 'ON:0.0000' ||cr|| 'OFF:0.0000'
checklinePtn = pdm_getform('Input line pattern...',7,lineprompt)
if checklineptn = '' then exit_msg()
onoff. = ''
parse var CheckLinePtn onoff.1 (cr) onoff.2 (cr) onoff.3 (cr) onoff.4 (cr) onoff.5 (cr) onoff.6
baddata = 1
do i = 1 to 6 until baddata = 0 /* test loop for bad data */
if ~datatype(onoff.i,'N') then
baddata = 0
else
onoff.i = trunc(onoff.i,4)
end /* do i = 1 to 6 until baddata = 0 */
if baddata = 1 then do
testinput = 0
CheckLinePtn = '-1 'ONOFF.1' 'ONOFF.2' 'ONOFF.3' 'ONOFF.4' 'ONOFF.5' 'ONOFF.6
end
end /* else do while testinput = 1 */
call setClip(ClipCheckLinePtn,CheckLinePtn)
end /* when */
when command = commands.5 then do
fillprompt = 'No Fill' ||cr|| 'Solid Fill' ||cr|| 'Radial Fill' ||cr|| 'Linear Fill'
CheckFillColor = pdm_SelectFromList('Input fill type to search for...',30,3,2,fillprompt)
if CheckFillColor = '' then exit_msg()
select
when CheckFillColor = 'No Fill' then
CheckFillColor = 0
when CheckFillColor = 'Solid Fill' then do
CheckFillColor = 1
call GetColorPalete()
CheckFillColor1 = SelectFromList('Input fill color to search for...',30,count,2,colorlist)
if checkFillcolor1 = '' then exit_msg(fill color not entered)
end
when CheckFillColor = 'Radial Fill' then do
CheckFillColor = 2
call GetColorPalete()
CheckFillColor1 = SelectFromList('Input first radial fill color...',30,count,2,colorlist)
if checkFillcolor1 = '' then exit_msg(first radial fill color not entered)
CheckFillColor2 = SelectFromList('Input second radial fill color...',30,count,2,colorlist)
if checkFillcolor2 = '' then exit_msg(second radial fill color not entered)
end
otherwise /* CheckFillColor = 'Linear Fill' then */
CheckFillColor = 3
call GetColorPalete()
CheckFillColor1 = SelectFromList('Input first linear fill color...',30,count,2,colorlist)
if checkFillcolor1 = '' then exit_msg(first linear fill color not entered)
CheckFillColor2 = SelectFromList('Input second linear fill color...',30,count,2,colorlist)
if checkFillcolor2 = '' then exit_msg(second linear fill color not entered)
end /* select inside select */
call setClip(ClipCheckFillColor,CheckFillcolor)
call setClip(ClipCheckFillColor1,CheckFillcolor1)
call setClip(ClipCheckFillColor2,CheckFillcolor2)
end /* select */
when command = commands.6 then do
lineweightprompt = 'None' ||cr|| 'Hairline' ||cr|| '0.5 point' ||cr|| '1 point' ||cr|| '1.5 points' ||cr|| '2 points' ||cr|| '3 points' ||cr|| '4 points' ||cr|| 'Custom'
CheckLineWeight = SelectFromList('Input linewieght to search for...',30,9,2,LineWeightprompt)
if CheckLineWeight = '' then exit_msg()
select
when CheckLineWeight = 'None' then
ChecklineWeight = 0.00
when CheckLineWeight = 'Hairline' then
ChecklineWeight = 0.25
when CheckLineWeight = '0.5 point' then
ChecklineWeight = 0.50
when CheckLineWeight = '1 point' then
ChecklineWeight = 1.00
when CheckLineWeight = '1.5 points' then
ChecklineWeight = 1.50
when CheckLineWeight = '2 points' then
ChecklineWeight = 2.00
when CheckLineWeight = '3 points' then
ChecklineWeight = 3.00
when CheckLineWeight = '4 points' then
ChecklineWeight = 4.00
otherwise /* CheckLineWeight = 'Custom' then */
Flag = 1
do while flag = 1
CheckLineWeight = pdm_getform('Input line weight to search for...',6,'weight in inches = :0.000')
call pdm_clearStatus()
if CheckLineWeight = '' then exit_msg()
if ~datatype(CheckLineWeight,'N') then
call pdm_ShowStatus(Invalid input try again...)
else do
Flag = 0
checklineweight = checklineweight * 72
checklineweight = trunc(CheckLineWeight+.5e-2,2)
end /* else do */
end /* do */
end /* select */
call setClip(ClipCheckLineWeight,CheckLineWeight)
end /* when */
when command = commands.7 then do
linejoinprompt = 'Miter' ||cr|| 'Round' ||cr|| 'Bevel' ||cr|| 'Butt'
CheckLineJoin = SelectFromList('Input line join type to search for...',30,4,2,LineJoinprompt)
if CheckLineJoin = '' then exit_msg()
select
when CheckLineJoin = 'Miter' then
CheckLineJoin = 0
when CheckLineJoin = 'Round' then
CheckLineJoin = 1
when CheckLineJoin = 'Bevel' then
CheckLineJoin = 2
otherwise /* CheckLineJoin = 'Butt' then */
CheckLineJoin = 3
end /* select */
call setClip(ClipCheckLineJoin,CheckLineJoin)
end /* when */
/* Reserved for when Gold Disk Fixes function IsLocked
when command = commands.8 then do
end
*/
otherwise
end /* select */
call setClip(PreUsed,'ON')
end /* do while loop */
end /* if LastUsed = 0 or LastUsed = 'NotUsed' */
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/*!!!!!!!!!!!!!!!!!!!!!!!!Start Highlighting objects!!!!!!!!!!!!!!!!!!!!!*/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
if LastUsed = 2 then do
CheckposX = getclip(ClipCheckPosX)
CheckposY = getclip(ClipCheckPosY)
ChecksizeX = getclip(ClipCheckSizeX)
ChecksizeY = getclip(ClipCheckSizeY)
CheckLineColor = getclip(ClipCheckLineColor)
CheckLinePtn = getclip(ClipChecklinePtn)
CheckFillColor = getclip(ClipCheckFillcolor)
CheckFillColor1 = getclip(ClipCheckFillcolor1)
CheckFillColor2 = getclip(ClipCheckFillcolor2)
CheckLineWeight = getclip(ClipCheckLineWeight)
CheckLineJoin = getclip(ClipCheckLineJoin)
response = getclip(lastUsedResponse)
end
do while response ~= ''
parse var response command '0a'x response
nextobjpg = pdm_PageFirstObj()
if ~(nextobjpg = 0) then do
Do until nextobjpg = 0
select
when command = commands.1 then do
currentobjpos = pdm_getobjposn(nextobjpg)
currentobjposX = word(currentobjpos,1)
currentobjposY = word(currentobjpos,2)
if currentobjposx = checkposx & currentobjposy = checkposy then
call pdm_selectAnother(nextobjpg)
end /* do */
when command = commands.2 then do
currentobjsize = pdm_getobjsize(nextobjpg)
currentobjsizex = word(currentobjsize,1)
currentobjsizey = word(currentobjsize,2)
if currentobjsizex = checksizex & currentobjsizey = checksizey then
call pdm_selectAnother(nextobjpg)
end
when command = commands.3 then do
currentobjlinecolor = pdm_getlinecolor(nextobjpg)
currentobjlineweight = pdm_getlineweight(nextobjpg)
if ~(currentobjlineweight = 0.00) then do
if currentobjlinecolor = checklinecolor then
call pdm_selectAnother(nextobjpg)
end
end
when command = commands.4 then do
currentobjlineptn = pdm_getlinepattern(nextobjpg)
patternNum = word(currentobjlineptn,1)
userpatternNum = word(checkLinePtn,1)
if userpatternNum = -1 then do
patternNum = subword(currentobjlineptn,2)
userpatternNum = subword(checkLinePtn,2)
if patternNum == userpatternNum then do
currentobjlineweight = pdm_getlineweight(nextobjpg)
if ~(currentobjlineweight = 0.00) then
call pdm_selectAnother(nextobjpg)
end
end
else
currentobjlineweight = pdm_getlineweight(nextobjpg)
if ~(currentobjlineweight = 0.00) then
if patternNum = userpatternNum then
call pdm_selectAnother(nextobjpg)
end /* select */
when command = commands.5 then do
currentobjfillptn = pdm_getfillpattern(nextobjpg)
parse var currentobjfillptn objnum (cr) firstcolor (cr) secondcolor (cr) rest
if word(checkfillcolor,1) = objnum then
select
when word(checkfillcolor,1) = 0 then /* No Fill */
call pdm_selectAnother(nextobjpg)
when word(checkfillcolor,1) = 1 then do /* Solid Fill */
if checkfillcolor1 = firstcolor then
call pdm_selectAnother(nextobjpg)
end
when word(checkfillcolor,1) = 2 then do /* Radial Fill */
if checkfillcolor1 = firstcolor & checkfillcolor2 = secondcolor then
call pdm_selectAnother(nextobjpg)
end
when word(checkfillcolor,1) = 3 then do /* Linear Fill */
if checkfillcolor1 = firstcolor & checkfillcolor2 = secondcolor then
call pdm_selectAnother(nextobjpg)
end
otherwise
end /* select */
end /* when */
when command = commands.6 then do
currentobjlineweight = pdm_getlineweight(nextobjpg)
if currentobjlineweight = checklineweight then
call pdm_selectAnother(nextobjpg)
end
when command = commands.7 then do
currentobjlinejoin = pdm_getlinejoin(nextobjpg)
if currentobjlinejoin = checklinejoin then
call pdm_selectAnother(nextobjpg)
end
/* when command = commands.8 then do
end
*/
otherwise
end /* select */
nextobjpg = pdm_PageNextObj(nextobjpg)
end /* Do until nextObjpg = 0 */
end /* if ~(nextobjpg = 0) */
end /* do while response ~= '' */
call exit_msg()
GetColorPalete:
colorlist = GetColorList()
if ~(colorlist = '') then do
count = 1
pos = index(colorlist, cr)
do while pos > 0
count = count + 1
pos = index(colorlist, cr, pos + 1)
end
end
else
exit_msg(Color palatte not found)
return
exit_msg: /*procedure expose units */
do
parse arg message
if message ~= '' then
call pdm_Inform(1, message,)
call pdm_ClearStatus()
exit
end